package com.example.onlineeducation.data.db.room

import androidx.room.*

/**
 * Creator: yc
 * Date: 2021/2/22 10:21
 * UseDes:搜索记录dao
 */
@Dao
interface SearchHistoryDao {
    /**
     * 查询所有数据
     */
    @Query("SELECT * FROM tab_search_history Where search_history_name = :acount")
    fun getSearchHistoryTable(acount: String): List<SearchHistoryTable>


    /**
     * 添加一个或多个数据（主键一样覆盖）
     * @param searchHistoryTable Array<out SearchHistoryTable>
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(vararg searchHistoryTable: SearchHistoryTable)

    @Query("DELETE FROM tab_search_history Where search_history_name = :acount")
    fun deleteForAcount(acount: String): Int
    /**
     * 删除表所有数据
     */
    @Query("DELETE FROM tab_search_history")
    fun delete(): Int
}